import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { GImageBitmap } from "../../../../../com/mui/controls/GImageBitmap";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { SGangFightsTeamMember } from "../../../../../Message/Public/SGangFightsTeamMember";
import { AvatarInfo } from "../../../resource/info/AvatarInfo";
import { AvatarType } from "../../../resource/info/AvatarType";
import { ObjTeamCreate } from "../../common/ObjTeamCreate";
import { CareerConfig } from "../../../resource/CareerConfig";
//class GangFightsPlayerCellRenderer
    
    export  class GangFightsPlayerCellRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this.addChild(new GImageBitmap("Friend_Bg_Head.swf", 0, 4));
            this._imgHead = new GImageBitmap();
            ObjCreate.setObjAttri(this._imgHead, 18, 22, -1, -1, this);
            this._tfName = ObjCreate.createTextField(Language.getString(44436), 98, 18, 200, 20, this);
            this._tfLevel = ObjCreate.createTextField(Language.getString(44437), 98, 43, 100, 20, this);
            this._tfCareer = ObjCreate.createTextField(Language.getString(44438), 263, 43, 100, 20, this);
            this._tfWerfare = ObjCreate.createTextField(Language.getString(44439), 98, 68, 100, 20, this);
            this._tfScore = ObjCreate.createTextField(Language.getString(44440), 263, 68, 100, 20, this);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "sgangfightsteammember") 
            {
                this._teamMember = arg1 as SGangFightsTeamMember;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            if (this._teamMember) 
            {
                this._imgHead.imgUrl = AvatarInfo.getPlayerAvatarName(this._teamMember.camp, this._teamMember.sex, AvatarType.BIG, this._teamMember.avatarId);
                ObjTeamCreate.setTextFieldKeyValue(this._tfName, Language.getString(44436), this._teamMember.name);
                ObjTeamCreate.setTextFieldKeyValue(this._tfLevel, Language.getString(44437), this._teamMember.level.toString());
                ObjTeamCreate.setTextFieldKeyValue(this._tfCareer, Language.getString(44438), CareerConfig.instance.getInfoByCode(this._teamMember.career).name);
                ObjTeamCreate.setTextFieldKeyValue(this._tfWerfare, Language.getString(44439), this._teamMember.warfare.toString());
                ObjTeamCreate.setTextFieldKeyValue(this._tfScore, Language.getString(44440), this._teamMember.mark.toString());
            }
            return;
        }

        /* internal */ /* var */_imgHead: GImageBitmap;

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfLevel: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCareer: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfWerfare: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfScore: Object /* flash.text.TextField */;

        /* internal */ /* var */_teamMember: SGangFightsTeamMember;
    }
